import book.Booklist;
import user.Admin;
import user.Normal;
import user.User;

import java.util.Scanner;

public class Main {
    public static User login(){
        Scanner in = new Scanner(System.in);
        System.out.println("请输入你的姓名：");
        String name = in.nextLine();
        System.out.println("请输入你的身份：--->1.管理员 0--->普通用户");
        int choice = in.nextInt();
        if(choice == 1) {
            Admin admin = new Admin(name);
            return admin;
        }else{
            Normal normal = new Normal(name);
            return normal;
        }
    }
    public static void main(String[] args) {
        Booklist booklist = new Booklist();
        User user = login();
        while(true){
            int ret = user.menu();
            if(ret>4||ret<0){
                System.out.println("选择错误！");
                break;
            }
            user.dooperation(ret,booklist);
        }


    }
}
